package com.openlogic.datasource.api.enums;

/**
* @ClassName: DataCategory
* @Description: 元数据大类枚举类
* @author weiyongpeng
* @date 2024年11月9日 下午2:57:39
 */
public enum DataCategory {

    RDB("oltp", 1 , "关系型数据库"),
    EXCEL("excel", 2 , "Excel表格"),
    API("api", 3 , "外部API");

    private final String key;

    private final Integer level;
    
    private final String name;

    DataCategory(String key, Integer level, String name) {
        this.key = key;
        this.level = level;
        this.name = name;
    }

    public String getKey() {
        return key;
    }

    public Integer getLevel() {
        return level;
    }
    
    public String getName() {
		return name;
	}

	public static DataCategory getCategory(String key) {
        for (DataCategory type : DataCategory.values()) {
            if (type.level.equals(Integer.valueOf(key))) {
                return type;
            }
        }
        return RDB;
    }
}
